/** @jsxImportSource @emotion/react */
import * as React from "react";
import {Text, useTheme,} from "customize-easy-ui-component";
import { ReportViewProps, } from "../../common/base";
import {末尾链接, 落款单位地址,} from "../../common/rarelyVary";
import {useRepMenuDirItems} from "../../hook/useMainRepUrlOr";
import {注意事项IndPl,} from "../../industrial/rarelyVary";
import {useItemsMapPressure} from "../../common/pressure";
import {PipeLineDiagram} from "../../industrial/viewLineDg";
import {Projects默认} from "./Regular.O-1";
import {PipelineCharacteristPla} from "./viewFeature";
import {检验结论报告} from "./Conclusion";
import {ConclusionAppendixVw, } from "./ConclusionAppendix";
import {目录页VS} from "../../movable/rarelyVary";
import {ReportFirstPageHeadNmaNmbm} from "../../contain/rarelyVary";
import {首页设备概况Plas} from "./rarelyVary";


export const ReportView: React.FunctionComponent<ReportViewProps> = ({
    repId,   source: orc,  verId,rep,
}) => {
  const theme= useTheme();
    const [mapFxian]=useItemsMapPressure({ projects:orc.Projects });
    const [rootMenu]=useRepMenuDirItems(Projects默认, orc.Projects, `/reportView/${rep?.modeltype}/ver/${verId}/${repId}`);
  return (
    <React.Fragment>
        {rootMenu}
        <div css={{"@media not print": {marginTop: '1rem', marginBottom: '1rem'}}}>
          <div css={{
              display: 'flex',
              flexDirection: 'column',
              justifyContent: 'space-between',
              "@media print": {
                    height:'100vh',       //一张纸的高度！同时配合 pageBreakAfter: 'always', 来约束特定纸张大小；
                    pageBreakInside: 'avoid',
              }
          }}>
                {ReportFirstPageHeadNmaNmbm({theme, rep})}
                <div>
                    <Text variant="h3" css={{textAlign: 'center',
                        "@media (min-width:690px),print and (min-width:538px)": {fontSize: theme.fontSizes[6],}
                    }}>压力管道定期检验报告<br/>
                    </Text>
                    <Text variant="h4" css={{textAlign: 'center',
                    }}>（公用管道-聚乙烯）</Text>
                    <br css={{"@media not print": {display: 'none'}}}/>
                    <Text variant="h6" css={{textAlign: 'center',}}>（ FJB/DC 1111-0-2021 ）</Text>
                </div>
                <div>{首页设备概况Plas({theme, orc, rep})}</div>
                <div css={{textAlign: 'center', "@media print": {pageBreakInside: 'avoid'}}}>
                    {落款单位地址}
                </div>
           </div>       {/*第一页纸张的,前面必定新断开打印一页的,才能确保100vh盛满一张纸张的底部区域,保证内容不会大于100vh前提下的稳妥做法*/}

            {注意事项IndPl({
                rep,
                comply: '书为依据《压力管道定期检验规则——公用管道》（TSG D7004-2010）制定，适用于压力管道定期检验报告（公用管道-聚乙烯）的结论报告，检验结论仅代表该设备在检验时的安全状况'
            })}

            {目录页VS({theme, orc, rep})}
            {检验结论报告({theme, orc, rep})}
            {mapFxian.get('公用管道全面检验结论报告附页')?.do && <ConclusionAppendixVw orc={orc} rep={rep} table='附页表' title={'全面检验结论报告附页'}/>}
            {mapFxian.get('管道特性表')?.do &&
                <PipelineCharacteristPla orc={orc} rep={rep}/>
            }
            {mapFxian.get('管道单线图')?.do &&
                <PipeLineDiagram orc={orc} rep={rep} title={'管道单线图'}/>
            }
        </div>
        {末尾链接({template: rep?.modeltype, verId, repId: repId || ''})}
    </React.Fragment>
  );
}
